#include<iostream>
#include<vector>

#include<cmath>
using namespace std;


//arroid test1()
//{
//	arrector<int> arr(1);
//	arr.push_back(0);
//	arr.push_back(2);
//	arr.push_back(3);
//	arr.push_back(0);
//	arr.push_back(4);
//	arr.push_back(5);
//	arr.push_back(0);
//
//	int cur = 0, dest = -1;
//	int i = 0;
//	while (cur < arr.size() && dest < (int)arr.size())
//	{
//		if (arr[cur] == 0)
//		{
//			dest++;
//		}
//		dest++;
//		cur++;
//	}
//	
//	cout << dest << " " << cur << endl;
//}
//
//
//arroid test2()
//{
//	arrector<int> arr(1);
//	arr.push_back(0);
//	arr.push_back(2);
//	arr.push_back(3);
//	arr.push_back(0);
//	//arr.push_back(4);
//	//arr.push_back(5);
//	//arr.push_back(0);
//	int cur = 0, dest = -1;
//	for (cur = 0, dest = -1; dest < (int)arr.size() && cur < arr.size(); ++cur, ++dest)
//	{
//		if (arr[cur] == 0)
//		{
//			++dest;
//		}
//
//	}
//	cout << dest << " " << cur << endl;
//}



void test1()
{
	vector<int> arr;

    arr.push_back(1);
	arr.push_back(0);
	arr.push_back(2);
	arr.push_back(3);
	arr.push_back(0);
	arr.push_back(4);
	arr.push_back(5);
	arr.push_back(0);

    int cur = 0, dest = -1;
    int sz = arr.size();
    while (cur < sz && dest < sz)
    {
        if (arr[cur] == 0)
        {
            dest++;
        }
        dest++;
        cur++;
    }

    if (arr[cur] == 0)
    {
        arr[--dest] = 0;
        dest -= 2;
        cur--;
    }
    else
    {
        --dest, --cur;
    }
    while (dest >= 0 && cur>=0)
    {
        if (arr[cur] == 0)
        {

            arr[dest] = 0;
            arr[--dest] = arr[cur];
        }
        else
        {
            arr[dest] = arr[cur];
        }
        cur--;
        dest--;
    }


    for (auto e : arr)
    {
        cout << e << " ";
    }
}



void test3()
{
    vector<int> arr;

    arr.push_back(1);
    arr.push_back(4);
    arr.push_back(2);
    arr.push_back(0);
    arr.push_back(6);
    arr.push_back(8);
    arr.push_back(0);
    arr.push_back(6);
    arr.push_back(0);

    int cur = 0, dest = -1;
    int sz = arr.size();
    while (cur < sz)
    {
        if (arr[cur])
            dest++;
        else dest += 2;
        if (dest >= sz - 1)
            break;
        cur++;

    }
    if (arr[sz-1] == 0)
    {
        arr[sz - 2] = 0;
        dest -= 2;
        cur--;
    }

    while (cur >= 0)
    {
        if (arr[cur])
        {
            arr[dest--] = arr[cur--];
        }
        else
        {
            arr[dest--] = 0;
            arr[dest--] = 0;
            cur--;
        }
    }

    for (auto e : arr)
    {
        cout << e << " ";
    }
}




int getnextnums(int n)
{
    int num = 0;

    while (n)
    {
        num += pow(n % 10,2);
        n /= 10;
    }

    return num;
}

void  test4()
{
    int n = 19;
    int slow = n;
    int fast = getnextnums(n);
    while (slow != fast)
    {
        slow = getnextnums(slow);
        fast = getnextnums(fast);
        fast = getnextnums(fast);
    }
    if (fast == slow && slow == 1)
    {
        cout << true << endl;
    }
    else
    {
        cout << false<< endl;
    }
}






//int main()
//{
//	test4();
//	return 0;
//}

#include "list.h"

int main()
{
    bit::test();

    return 0;
}
